home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr50
/
pbc22b.zip
/
PBC$BAS.ZIP
/
PATCH.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-01-01
|
2KB
|
52 lines
' +----------------------------------------------------------------------+
' | |
' | PBClone Copyright (c) 1990-1993 Thomas G. Hanlin III |
' | |
' +----------------------------------------------------------------------+
DECLARE SUB FClose1 (BYVAL FileHandle%)
DECLARE SUB FOpen1 (FileName$, BYVAL ReadWrite%, BYVAL Sharing%, FileHandle%, ErrCode%)
DECLARE SUB FSetOfs (BYVAL FileHandle%, Offset&)
DECLARE SUB SFRead (BYVAL FileHandle%, St$, BytesRead%, ErrCode%)
DECLARE SUB SFWrite (BYVAL FileHandle%, St$, BytesWritten%, ErrCode%)
DECLARE FUNCTION Patch01% ()
DECLARE SUB Patch00 (BYVAL FileHandle%)
SUB FindPatch (FileName$, SearchSt$, ErrCode%)
IF INSTR(FileName$, ".") THEN
File$ = FileName$
ELSE
File$ = FileName$ + ".EXE"
END IF
FOpen1 File$, 2, 2, Handle%, ErrCode%
Chunk$ = SPACE$(512)
DO UNTIL Found% OR ErrCode%
SFRead Handle%, Chunk$, BytesRead%, ErrCode%
St$ = RIGHT$(St$ + LEFT$(Chunk$, BytesRead%), 768)
IF ErrCode% <= 0 THEN
tmp% = INSTR(St$, SearchSt$)
IF tmp% THEN
Found% = -1
FSetOfs Handle%, CLNG(tmp% + LEN(SearchSt$) + 5 - LEN(St$))
Patch00 Handle%
END IF
END IF
LOOP
IF ErrCode% <= 0 THEN ErrCode% = NOT Found%
END SUB
SUB PatchDone
FClose1 Patch01%
END SUB
SUB SetPatch (St$)
Handle% = Patch01%
SFWrite Handle%, St$, BytesWritten%, ErrCode%
FSetOfs Handle%, 6&
END SUB